GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — master (#573)
by Jesus
04:29
created

$(document).turbolinks:load   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
dl 0
loc 6
rs 10
c 1
b 0
f 0
eloc 4
nc 2
nop 1
1
// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
2
//
3
// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
4
//
5
// This program is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU Lesser General Public License as published by the Free Software
7
// Foundation; either version 3.0 of the License, or (at your option) any later
8
// version.
9
//
10
// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
11
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
13
//
14
// You should have received a copy of the GNU Lesser General Public License along
15
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
16
17
$(document).on('turbolinks:load', function(){
18
  var controller = $("body").data('controller');
19
  var action = $("body").data('action');
20
21
  if ((controller == "admins" && action == "index") || 
22
      (controller == "rooms" && action == "show") || 
23
      (controller == "rooms" && action == "update") ||
24
      (controller == "rooms" && action == "join") || 
25
      (controller == "users" && action == "recordings")) {
26
    // Submit search if the user hits enter
27
    $("#search-input").keypress(function(key) {
28
      var keyPressed = key.which
29
      if (keyPressed == 13) {
30
        searchPage()
31
      }
32
    })
33
34
    // Add listeners for sort
35
    $("th[data-order]").click(function(data){
36
      var header_elem = $(data.target)
37
      var controller = $("body").data('controller');
38
      var action = $("body").data('action');
39
40
      if(header_elem.data('order') === 'asc'){ // asc
41
        header_elem.data('order', 'desc');
42
      }
43
      else if(header_elem.data('order') === 'desc'){ // desc
44
        header_elem.data('order', 'none');
45
      }
46
      else{ // none
47
        header_elem.data('order', 'asc');
48
      }
49
50
      var search = $("#search-input").val();
51
52
      if(controller === "rooms" && action === "show"){
53
        window.location.replace(window.location.pathname + "?page=1&search=" + search + 
54
          "&column=" + header_elem.data("header") + "&direction="+ header_elem.data('order') + 
55
          "#recordings-table");
56
      }
57
      else{
58
        window.location.replace(window.location.pathname + "?page=1&search=" + search + 
59
          "&column=" + header_elem.data("header") + "&direction="+ header_elem.data('order'));
60
      }
61
    })
62
63
    if(controller === "rooms" && action === "show"){
64
      $(".page-item > a").each(function(){
65
        if(!$(this).attr('href').endsWith("#")){
66
          $(this).attr('href', $(this).attr('href') + "#recordings-table")
67
        }
68
      })
69
    }
70
  }
71
})
72
73
// Searches the user table for the given string
74
function searchPage() {
75
  var search = $("#search-input").val();
76
77
  var controller = $("body").data('controller');
78
  var action = $("body").data('action');
79
80
  // Check if the user filtered by role
81
  var role = new URL(location.href).searchParams.get('role')
1 ignored issue
show
Bug introduced by
The variable URL seems to be never declared. If this is a global, consider adding a /** global: URL */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
82
83
  var url = window.location.pathname + "?page=1&search=" + search
84
85
  if (role) {
86
    url += "&role=" + role
87
  }  
88
89
  if(controller === "rooms" && action === "show"){
90
    window.location.replace(url + "#recordings-table");
91
  } else{
92
    window.location.replace(url);
93
  }
94
  
95
}
96
97
// Clears the search bar
98
function clearSearch() {
99
  var controller = $("body").data('controller');
100
  var action = $("body").data('action');
101
102
  var role = new URL(location.href).searchParams.get('role')
0 ignored issues
show
Bug introduced by
The variable URL seems to be never declared. If this is a global, consider adding a /** global: URL */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
103
104
  var url = window.location.pathname + "?page=1"
105
106
  if (role) {
107
    url += "&role=" + role
108
  }  
109
110
  if(controller === "rooms" && action === "show"){
111
    window.location.replace(url + "#recordings-table");
112
  } else{
113
    window.location.replace(url);
114
  }
115
}
116